package org.btik.bean.impl;


import org.btik.bean.impl.temporary.CacheStruct;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * bean的存储
 */
public class BeanCache {

    static Map<String, Object> idMap;

    static Map<String, List<Object>> typeMap = new HashMap<>();

    static void store(CacheStruct<Object> beans) {
        idMap = beans.getIdBeanMap();
        for (Object noneNameBean : beans.getNoneIdBeans()) {
            typeMap.computeIfAbsent(noneNameBean.getClass().getName(), (key) -> new ArrayList<>())
                    .add(noneNameBean);
        }
        idMap.forEach((key, value) -> typeMap.computeIfAbsent(value.getClass().getName(),
                        (k) -> new ArrayList<>())
                .add(value));


    }


}
